home *** CD-ROM | disk | FTP | other *** search
/ Aminet 52 / Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso / Aminet / dev / gg / ncurses-5.3.lha / ncurses-5.3 / form / frm_hook.c < prev    next >
C/C++ Source or Header  |  2002-10-24  |  7KB  |  142 lines

  1. /****************************************************************************
  2.  * Copyright (c) 1998,2000 Free Software Foundation, Inc.                   *
  3.  *                                                                          *
  4.  * Permission is hereby granted, free of charge, to any person obtaining a  *
  5.  * copy of this software and associated documentation files (the            *
  6.  * "Software"), to deal in the Software without restriction, including      *
  7.  * without limitation the rights to use, copy, modify, merge, publish,      *
  8.  * distribute, distribute with modifications, sublicense, and/or sell       *
  9.  * copies of the Software, and to permit persons to whom the Software is    *
  10.  * furnished to do so, subject to the following conditions:                 *
  11.  *                                                                          *
  12.  * The above copyright notice and this permission notice shall be included  *
  13.  * in all copies or substantial portions of the Software.                   *
  14.  *                                                                          *
  15.  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
  16.  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
  17.  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
  18.  * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
  19.  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
  20.  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
  21.  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
  22.  *                                                                          *
  23.  * Except as contained in this notice, the name(s) of the above copyright   *
  24.  * holders shall not be used in advertising or otherwise to promote the     *
  25.  * sale, use or other dealings in this Software without prior written       *
  26.  * authorization.                                                           *
  27.  ****************************************************************************/
  28.  
  29. /****************************************************************************
  30.  *   Author:  Juergen Pfeifer, 1995,1997                                    *
  31.  *   Contact: http://www.familiepfeifer.de/Contact.aspx?Lang=en             *
  32.  ****************************************************************************/
  33.  
  34. #include "form.priv.h"
  35.  
  36. MODULE_ID("$Id: frm_hook.c,v 1.10 2002/07/06 15:33:27 juergen Exp $")
  37.  
  38. /* "Template" macro to generate function to set application specific hook */
  39. #define GEN_HOOK_SET_FUNCTION( typ, name ) \
  40. NCURSES_IMPEXP int NCURSES_API set_ ## typ ## _ ## name (FORM *form, Form_Hook func)\
  41. {\
  42.    (Normalize_Form( form ) -> typ ## name) = func ;\
  43.    RETURN(E_OK);\
  44. }
  45.  
  46. /* "Template" macro to generate function to get application specific hook */
  47. #define GEN_HOOK_GET_FUNCTION( typ, name ) \
  48. NCURSES_IMPEXP Form_Hook NCURSES_API typ ## _ ## name ( const FORM *form )\
  49. {\
  50.    return ( Normalize_Form( form ) -> typ ## name );\
  51. }
  52.  
  53. /*---------------------------------------------------------------------------
  54. |   Facility      :  libnform  
  55. |   Function      :  int set_field_init(FORM *form, Form_Hook f)
  56. |   
  57. |   Description   :  Assigns an application defined initialization function
  58. |                    to be called when the form is posted and just after
  59. |                    the current field changes.
  60. |
  61. |   Return Values :  E_OK      - success
  62. +--------------------------------------------------------------------------*/
  63. GEN_HOOK_SET_FUNCTION(field,init)
  64.  
  65. /*---------------------------------------------------------------------------
  66. |   Facility      :  libnform  
  67. |   Function      :  Form_Hook field_init(const FORM *form)
  68. |   
  69. |   Description   :  Retrieve field initialization routine address.
  70. |
  71. |   Return Values :  The address or NULL if no hook defined.
  72. +--------------------------------------------------------------------------*/
  73. GEN_HOOK_GET_FUNCTION(field,init)
  74.  
  75. /*---------------------------------------------------------------------------
  76. |   Facility      :  libnform  
  77. |   Function      :  int set_field_term(FORM *form, Form_Hook f)
  78. |   
  79. |   Description   :  Assigns an application defined finalization function
  80. |                    to be called when the form is unposted and just before
  81. |                    the current field changes.
  82. |
  83. |   Return Values :  E_OK      - success
  84. +--------------------------------------------------------------------------*/
  85. GEN_HOOK_SET_FUNCTION(field,term)
  86.  
  87. /*---------------------------------------------------------------------------
  88. |   Facility      :  libnform  
  89. |   Function      :  Form_Hook field_term(const FORM *form)
  90. |   
  91. |   Description   :  Retrieve field finalization routine address.
  92. |
  93. |   Return Values :  The address or NULL if no hook defined.
  94. +--------------------------------------------------------------------------*/
  95. GEN_HOOK_GET_FUNCTION(field,term)
  96.  
  97. /*---------------------------------------------------------------------------
  98. |   Facility      :  libnform  
  99. |   Function      :  int set_form_init(FORM *form, Form_Hook f)
  100. |   
  101. |   Description   :  Assigns an application defined initialization function
  102. |                    to be called when the form is posted and just after
  103. |                    a page change.
  104. |
  105. |   Return Values :  E_OK       - success
  106. +--------------------------------------------------------------------------*/
  107. GEN_HOOK_SET_FUNCTION(form,init)
  108.  
  109. /*---------------------------------------------------------------------------
  110. |   Facility      :  libnform  
  111. |   Function      :  Form_Hook form_init(const FORM *form)
  112. |   
  113. |   Description   :  Retrieve form initialization routine address.
  114. |
  115. |   Return Values :  The address or NULL if no hook defined.
  116. +--------------------------------------------------------------------------*/
  117. GEN_HOOK_GET_FUNCTION(form,init)
  118.  
  119. /*---------------------------------------------------------------------------
  120. |   Facility      :  libnform  
  121. |   Function      :  int set_form_term(FORM *form, Form_Hook f)
  122. |   
  123. |   Description   :  Assigns an application defined finalization function
  124. |                    to be called when the form is unposted and just before
  125. |                    a page change.
  126. |
  127. |   Return Values :  E_OK       - success
  128. +--------------------------------------------------------------------------*/
  129. GEN_HOOK_SET_FUNCTION(form,term)
  130.  
  131. /*---------------------------------------------------------------------------
  132. |   Facility      :  libnform  
  133. |   Function      :  Form_Hook form_term(const FORM *form)
  134. |   
  135. |   Description   :  Retrieve form finalization routine address.
  136. |
  137. |   Return Values :  The address or NULL if no hook defined.
  138. +--------------------------------------------------------------------------*/
  139. GEN_HOOK_GET_FUNCTION(form,term)
  140.  
  141. /* frm_hook.c ends here */
  142.